package Class::Scaffold::YAML::Active::ExceptionContainer;

# $Id: ExceptionContainer.pm 13653 2007-10-22 09:11:20Z gr $

use warnings;
use strict;
use YAML::Active qw/assert_arrayref array_activate/;


our $VERSION = '0.04';


use base 'Class::Scaffold::YAML::Active';


sub yaml_activate {
    my ($self, $phase) = @_;
    assert_arrayref($self);
    my $exceptions = array_activate($self, $phase);

    # Expect a list of hashrefs; each hash element is an exception with a
    # 'ref' key giving the exception class, and the rest being treated as args
    # to give to the exception when it is being recorded. Example:
    #
    #  exception_container: !perl/Class::Scaffold::YAML::Active::ExceptionContainer
    #    - ref: Class::Scaffold::Exception::Policy::Blah
    #      property1: value1
    #      property2: value2

    my $container = $self->delegate->make_obj('exception_container');
    for my $exception (@$exceptions) {
        my $class = $exception->{ref};
        delete $exception->{ref};
        $container->record($class, %$exception);
    }
    $container;
}


1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

{% p.package %} - large-scale OOP application support

=head1 SYNOPSIS

    {% p.package %}->new;

=head1 DESCRIPTION

=head1 METHODS

=over 4

{% p.write_methods %}

=back

{% p.write_inheritance %}

{% PROCESS standard_pod %}

=cut

